from core.spider.easy.CrawlWorker import  *
from core.spider.easy.PostWorker import  *
from core.spider.easy.ReplyWorker import  *

class EasyTaskBuidder:

    workers = []

    def __init__(self,easyTaskContext):
        self.easyTaskContext = easyTaskContext

    def handler(self):

        if self.easyTaskContext.crawlUrlSwitch or self.easyTaskContext.crawlContentSwitch:
            print('这里1')
            crawlWorker = CrawlWorker(self.easyTaskContext)
            self.workers.append(crawlWorker)

        if self.easyTaskContext.postSwitch :
            print('这里2')
            postWorker = PostWorker(self.easyTaskContext)
            self.workers.append(postWorker)

        if self.easyTaskContext.postSwitch :
            print('这里3')
            replyWorker = ReplyWorker(self.easyTaskContext)
            self.workers.append(replyWorker)


        return  self.workers